package com.cskaoyan.mapper;

import com.cskaoyan.bean.MarketOrder;
import com.cskaoyan.bean.MarketOrderExample;

import java.util.List;

import com.cskaoyan.bean.vo.admin.order.MarketOrderDetailVo;
import org.apache.ibatis.annotations.Param;

public interface MarketOrderMapper {
    long countByExample(MarketOrderExample example);

    int deleteByExample(MarketOrderExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(MarketOrder record);

    int insertSelective(MarketOrder record);

    List<MarketOrder> selectByExample(MarketOrderExample example);

    MarketOrder selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") MarketOrder record, @Param("example") MarketOrderExample example);

    int updateByExample(@Param("record") MarketOrder record, @Param("example") MarketOrderExample example);

    int updateByPrimaryKeySelective(MarketOrder record);

    int updateByPrimaryKey(MarketOrder record);

    Integer queryOrderTotal();

    /**
     * 查询订单详情中的OrderGoods
     *
     * @param orderId 订单id
     * @return List<MarketOrderDetailVo.OrderGoods>
     */
    List<MarketOrderDetailVo.OrderGoods> selectOrderGoodsByOrderId(String orderId);

    /**
     * 查询订单详情中的User
     *
     * @param useId 用户id
     * @return MarketOrderDetailVo.User
     */
    MarketOrderDetailVo.User selectUserByUserId(String useId);

    /**
     * 查询订单详情中的Order
     *
     * @param orderId 订单id
     * @return MarketOrderDetailVo.Order
     */
    MarketOrder selectOrderById(String orderId);
    //MarketOrderDetailVo.Order selectOrderById(String orderId);

    /**
     * 根据商品id查询商品的规格
     *
     * @param goodsId 商品id
     * @return String数组
     */
    String[] selectSpecificationsByGoodsId(Integer goodsId);

    /**
     * 根据订单id查询用户id
     *
     * @param orderId 订单id
     * @return 用户id
     */
    String selectUseIdByOrderId(String orderId);

    /**
     * 订单发货
     *
     * @param marketOrder 发货信息
     */
    void updateOrdersByShip(MarketOrder marketOrder);

    /**
     * 根据订单id更新订单信息
     *
     * @param orderId 订单id
     * @return 影响的行数
     */
    int updateOrderByDelete(String orderId);

    Integer queryUnNum(Integer userId, int i);

    Integer queryUncomment(Integer userId);

}
